import axios from "./utils/axios.js";
// 登录
function Login(user, pass) {
  const url = "/user/login";
  return axios.get(url, { params:{user, pass} });
}
// 注册
function Reg(user, pass) {
  const url = "/user/register";
  return axios.post(url, { user, pass });
}

// 获取用户列表
function GetList(id) {
  const url = "/user/getUsers";
  return axios.get(url, {  params:{ id } });
}
// 添加用户
function Add(user, img, time, desc, title) {
  const url = "/user/creatUser";
  return axios.post(url, { user, img, time, desc, title });
}
// 删除用户
function Del(id) {
  const url = "/user/deluser";
  return axios.post(url, { id });
}
// 修改用户
function Update(user, id, img, time, desc, title) {
  const url = "/user/updateUser";
  return axios.post(url, { user, id, img, time, desc, title });
}

// 添加商品
function AddGoods(img,price, classify, title) {
  const url = "/Goods/createGoods";
  return axios.post(url, {img,price, classify, title});
}
// 获取商品
function GetGoods(id) {
  const url = "/Goods/getGoods";
  return axios.post(url, {id});
}
// 删除商品
function DelGoods(id) {
  const url = "/Goods/delgoods";
  return axios.post(url, { id });
}
// 修改商品
function UpdateGoods( img,price, classify, title) {
  const url = "/Goods/updateGoods";
  return axios.post(url, { img,price, classify, title });
}
export default {
  Login,
  Reg,
  GetList,
  Add,
  Del,
  Update,
  AddGoods,
  GetGoods,
  DelGoods,
  UpdateGoods
};
